New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

level-json-coerce-null

Package Overview
Dependencies
Maintainers
1
Versions
2
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

level-json-coerce-null

db.put(key, undefined....) will give you problems. This codec fixes it.

  • 1.0.1
  • latest
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
2
decreased by-77.78%
Maintainers
1
Weekly downloads
 
Created
Source

level-json-coerce-null

build status

db.put(key, undefined....) will give you problems. This codec fixes it.

It simply coerces undefined to null so it will encode properly. Note that when it decodes it will be null instead of undefined.

To use it, simply change

var db = level(... {
  valueEncoding: "json"
})

To this

var db = level(... {
  valueEncoding: require("level-json-coerce-null")
})

Rant

It's quite annoying that javascript has 2 ways of representing "nothing".

  • null - an object that is meant to represent nothing
  • undefined - the true nothing (it's also a re-assignable identifier)

WAT!

License

MIT

Keywords

FAQs

Package last updated on 01 Sep 2016

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc